<template>
	<view class="main">
		<view class="score">
			<view class="text">
				{{$t('course.score')}}:
			</view>
			<uni-rate :size="18" v-model="val" active-color="#4DBEC1" />
		</view>
		<view class="box">
			<uni-easyinput v-model="value" type="textarea" placeholder="请输入内容"></uni-easyinput>
		</view>
		<view class="btn" @click="submit">
			{{$t('index.submit')}}
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				val: 0,
				value: "",
				id:""
			}
		},
		onLoad(Options) {
			this.id = Options.id
		},
		methods: {
			goBack() {
				uni.navigateBack()
			},
			submit() {
				this.$httpRequest({
					url:"app/api/courseComment.php",
					method:"POST",
					data:{
						service:"moodle_mobile_app",
						courseid:this.id,
						score:this.val,
						content:this.value
					}
				}).then(res=>{
					if(res.errorcode==200){
						uni.showToast({
							title:"提交成功",
							icon:"none"
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.main {
		overflow: hidden;

		.nav {
			margin-top: 100rpx;
		}

		::v-deep .uni-navbar__header-container {
			justify-content: center;
		}

		.title {
			font-size: 18px;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #0F1826;
			// line-height: 88rpx;
			// text-align: center;
			height: 100%;
			display: flex;
			justify-content: center;
			align-items: center;
		}

		// .submit {
		// 	font-size: 18px;
		// 	font-family: PingFang SC-Medium, PingFang SC;
		// 	font-weight: 500;
		// 	color: #4DBEC1;
		// 	// line-height: 88rpx;
		// 	display: flex;
		// 	justify-content: center;
		// 	align-items: center;
		// }
		.btn {
			width: 90%;
			margin: 48rpx auto 0;
			text-align: center;
			line-height: 94rpx;
			color: #FFFFFF;
			font-size: 32rpx;
			font-weight: 500;
			border-radius: 144rpx;
			background: #4DBEC1;
		}
		.score {
			width: 90%;
			margin: 32rpx auto 0;
			display: flex;
			align-items: center;
			border-bottom: 2rpx solid #EBEDF0;
			padding-bottom: 36rpx;

			.text {
				margin-right: 12rpx;
			}
		}

		.box {
			width: 90%;
			margin: 20rpx auto 0;

			::v-deep .uni-easyinput__content {
				border: none;
			}
		}
	}
</style>
